package com.chonry.web2.controller;

import com.chonry.web2.bean.Result;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class ErrorController {

    @RequestMapping("/500")
    public Result handle500(HttpServletRequest request){
        Throwable throwable = (Throwable) request.getAttribute("javax.servlet.error.exception");
        return new Result(500,throwable.getMessage());
    }
}
